import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>();
        list.add("java1");
        list.add("java2");
        list.add("java2");
        list.add("java3");
        list.add("java4");
        list.add("java4");
      /*  Iterator<String> it=list.iterator();
        System.out.println(it.next());
        System.out.println(it.next());
        System.out.println(it.next());
        System.out.println(it.next());*/
       /* Iterator<String> it=list.iterator();
        while(it.hasNext()){
            System.out.println(it.next());
        }*/
       /* for (String ele: list) {
            System.out.println(ele);

        }*/
        list.forEach(s->{
            System.out.println(s);
        });
    }
}
